"""
需求：删除名称为‘西游记’的图书
步骤：
# 1.导入pymysql
# 2.建立连接
# 3.获取游标
# 4.执行SQL语句
# 5.关闭游标
# 6.关闭连接

注意：插入、更新和删除语句，需要提交事务才会生效
"""


import pymysql

connect = pymysql.connect(host='211.103.136.244', port=7061, user='student', password='iHRM_student_2021',
                       database='test_db', charset='utf8')

cursor = connect.cursor()

sql = "DELETE FROM t_book WHERE title = '告白气球'"
cursor.execute(sql)

# 提交事务
connect.commit()

cursor.close()
connect.close()